package it.eng.get.pdfwe.jr;

import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

public class PropertyLoader {

	private static final String PROPERTIES_FILE = "PDF_WE.properties";
	static Properties properties; 
	static {
		properties = new Properties();
		try {
			properties.load(PropertyLoader.class.getClassLoader().getResourceAsStream(PROPERTIES_FILE));
//			System.out.println("\n\n\nlisting:\n");
//			properties.list(System.out);
		} catch (Exception e) {
			System.out.println("Non posso caricare " + PROPERTIES_FILE);
			// TODO: handle exception
		}
		
		
	}
	
	
	public static Map<String,String> getFillers() {
		Map<String,String> res = new HashMap<String,String>();
		Set<Object> keys = properties.keySet();
		for (Object _key : keys) {
			String key=_key.toString();
			if (key.startsWith("report.filler.class.")) {
				res.put(key.replaceFirst("report\\.filler\\.class\\.", ""),properties.getProperty(key));
			}
		}
		return res;
	}
	
	
	
	
}
